---



# Default values for sonarqube.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
replicaCount: 1
image:
  repository: {{ sonarqube_repo }}
  tag: {{ sonarqube_tag }}
  # If using a private repository, the name of the imagePullSecret to use
  # pullSecret: my-repo-secret

# Set security context for sonarqube pod
securityContext:
  fsGroup: 999

wget:
  repository: "{{ wget_repo }}"
  tag: "{{ wget_tag }}"

service:
  name: sonarqube
  type: NodePort
  externalPort: 9000
  internalPort: 9000
  labels:
  annotations: {}
  # May be used in example for internal load balancing in GCP:
  # cloud.google.com/load-balancer-type: Internal
  loadBalancerSourceRanges:
    - 0.0.0.0/0
  # loadBalancerIP: 1.2.3.4
ingress:
  enabled: false
  # Used to create an Ingress record.
  hosts:
    - sonar.organization.com
  annotations: {}
  # kubernetes.io/ingress.class: nginx
  # kubernetes.io/tls-acme: "true"
  # This property allows for reports up to a certain size to be uploaded to SonarQube
  # nginx.ingress.kubernetes.io/proxy-body-size: "8m"
  tls: {}
  # Secrets must be manually created in the namespace.
  # - secretName: chart-example-tls
  #   hosts:
  #     - chart-example.local

# Affinity for pod assignment
# Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
affinity: {}

# Tolerations for pod assignment
# Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
tolerations: []

# Node labels for pod assignment
# Ref: https://kubernetes.io/docs/user-guide/node-selection/
nodeSelector: {}

# hostAliases allows the modification of the hosts file inside a container
hostAliases: []
# - ip: "192.168.1.10"
#   hostnames:
#   - "example.com"
#   - "www.example.com"

readinessProbe:
  initialDelaySeconds: 60
  periodSeconds: 5
  failureThreshold: 36
  sonarWebContext: /

# Set extra env variables. Like proxy settings.
extraEnv: {}

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
#  cpu: 100m
#  memory: 128Mi
# requests:
#  cpu: 100m
#  memory: 128Mi
persistence:
  enabled: false
  ## If defined, storageClassName: <storageClass>
  ## If set to "-", storageClassName: "", which disables dynamic provisioning
  ## If undefined (the default) or set to null, no storageClassName spec is
  ##   set, choosing the default provisioner.  (gp2 on AWS, standard on
  ##   GKE, AWS & OpenStack)
  ##
  # storageClass: "-"
  accessMode: ReadWriteOnce
  size: 10Gi

# List of plugins to install.
# For example:
# plugins:
#  install:
#    - "https://github.com/AmadeusITGroup/sonar-stash/releases/download/1.3.0/sonar-stash-plugin-1.3.0.jar"
#    - "https://github.com/SonarSource/sonar-ldap/releases/download/2.2-RC3/sonar-ldap-plugin-2.2.0.601.jar"
plugins:
  install:
    - "http://uc-jenkins-update-center/sonar-plugins/sonar-c-plugin-1.3.0.1746.jar"
    - "http://uc-jenkins-update-center/sonar-plugins/sonar-cxx-plugin-1.3.0.1746.jar"
  # - https://github.com/SonarSource/sonar-ldap/releases/download/2.2-RC3/sonar-ldap-plugin-2.2.0.601.jar
  resources: {}
  # We allow the plugins init container to have a separate resources declaration because
  # the initContainer does not take as much resources.

# A custom sonar.properties file can be provided using a multiline YAML string.
# For example:
sonarProperties: |
  sonar.security.realm=LDAP
  ldap.url=ldap://openldap.kubesphere-system.svc:389
  ldap.bindDn=cn=admin,dc=kubesphere,dc=io
  ldap.bindPassword=admin

  ldap.user.baseDn=ou=Users,dc=kubesphere,dc=io
  ldap.user.emailAttribute=mail
  ldap.user.realNameAttribute=uid
  ldap.user.request=(&(objectClass=inetOrgPerson)(|(uid={0})(mail={0})))

  ldap.group.baseDn=ou=Groups,dc=kubesphere,dc=io
  groupSearchFilter=(&(objectClass=posixGroup)(cn={0}))

{% if is_allinone is defined and is_allinone == true %}  
  sonar.web.javaOpts=-Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError
  sonar.ce.javaOpts=-Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError
  sonar.search.javaOpts=-Xms512m -Xmx512m -XX:+HeapDumpOnOutOfMemoryError
{% endif %}

## Configuration value to select database type
## Option to use "postgresql" or "mysql" database type, by default "postgresql" is chosen
## Set the "enable" field to true of the database type you select (if you want to use internal database) and false of the one you don't select
database:
  type: "postgresql"

## Configuration values for postgresql dependency
## ref: https://github.com/kubernetes/charts/blob/master/stable/postgresql/README.md
postgresql:
  # Enable to deploy the PostgreSQL chart
  enabled: true
  # To use an external PostgreSQL instance, set enabled to false and uncomment
  # the line below:
  # postgresServer: ""
  # To use an external secret for the password for an external PostgreSQL
  # instance, set enabled to false and provide the name of the secret on the
  # line below:
  # postgresPasswordSecret: ""
  image: "{{ postgres_repo }}"
  imageTag: "{{ postgres_tag }}"
  postgresUser: "sonarUser"
  postgresPassword: "sonarPass"
  postgresDatabase: "sonarDB"
  # Specify the TCP port that PostgreSQL should use
  service:
    port: 5432
  persistence:
    enabled: true
    storageClass: "{{ persistence.storageClass }}"
    accessMode: ReadWriteOnce
    size: {% if postgresql_pv_size is defined %}{{ postgresql_pv_size }}{% else %}{{ devops.sonarqube.postgresqlVolumeSize | default("8Gi") }}{% endif %}

mysql:
  # Enable to deploy the mySQL chart
  enabled: false
  # To use an external mySQL instance, set enabled to false and uncomment
  # the line below:
  # mysqlServer: "openpitrix-db.openpitrix-system.svc"
  # To use an external secret for the password for an external mySQL instance,
  # set enabled to false and provide the name of the secret on the line below:
  # mysqlPasswordSecret: ""
  mysqlUser: "root"
  mysqlPassword: "password"
  mysqlDatabase: "sonarDB"
  # mysqlParams:
  #   useSSL: "true"
  # Specify the TCP port that mySQL should use
  service:
    port: 3306

